# -*- mode: python ; coding: utf-8 -*-


# 获取多级目录下所有文件的路径
def get_data_files(directory):
    data_files = []
    for root, dirs, files in os.walk(directory):
        for file in files:
            # 计算相对路径
            file_path = os.path.join(root, file)
            data_files.append((file_path, root))
    return data_files

# 指定要包括的目录
datas = get_data_files('template')


a = Analysis(
    ['cattle.py'],
    pathex=[],
    binaries=[],
    datas=datas,
    hiddenimports=['script',],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    noarchive=False,
    optimize=0,
)
pyz = PYZ(a.pure)

exe = EXE(
    pyz,
    a.scripts,
    [],
    exclude_binaries=True,
    name='cattle',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    console=False,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)

coll = COLLECT(
    exe,
    a.binaries,
    a.datas,
    strip=False,
    upx=True,
    upx_exclude=[],
    name='cattle',
)
